package com.sjb.sixteen_journey_backend.controller;


import com.sjb.sixteen_journey_backend.common.R;
import com.sjb.sixteen_journey_backend.service.IMapRouteService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 地图路线表
 *
 * @author jcz
 * @since 2024-07-26
 */
@RestController
@RequestMapping("/map-route")
public class MapRouteController {
    @Autowired
    private IMapRouteService mapRouteService;

    /**
     * 添加一条地图路线
     * @param id 地图id
     * @param ids 路线会经过的地点id
     * @return
     */
    @PostMapping("/addMapRoute")
    public R addMapRoute(@RequestParam Integer id,
                         @RequestParam List<Integer> ids) {
        return mapRouteService.addMapRoute(id,ids);
    }

    /**
     * 删除一条地图路线
     * @param id
     * @return
     */
    @DeleteMapping("/removeMapRoute/{id}")
    public R removeMapRoute(@PathVariable Integer id) {
        return mapRouteService.removeMapRoute(id);
    }
}
